// views/todos/nav.js
Page({
  data: {
    text:'',
    id:'',
    content:''
  },
  change(){
    const self =this
    wx.request({
      url: `https://api.yizhanketang.cn/api/v1/todos/${self.data.id}`,
      method:'POST',
      data:{
        content:self.data.content
      },
      success() {
        wx.navigateTo({
          url: `./index`,
        })
      }
    })
   
  },
  onLoad(options) {
    /* 点击跳转后获取点击的内容 */
    const self =this
    const {id} = options
    console.log(id);
   wx.request({
     url: `https://api.yizhanketang.cn/api/v1/todos/${id}`,
     method:'GET',
     success(res){
     console.log(res.data.data.content);
     self.setData({
       text:res.data.data.content
     })
     },
   })
  },
})